<html>
<head>
    <script type="text/javascript">
        function getRelElement(event)
        {
            var txt="The cursor just exited the ";
            txt=txt + event.relatedTarget.tagName + " element.";
            alert(txt);
        }
    </script>
</head>
<body>

<p onmouseout="getRelElement(event)">
    Mouse over this paragraph.</p>

</body>
</html>